package com.etc.controller;

import com.etc.entity.Admin;
import com.etc.entity.CommentResult;
import com.etc.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
public class AdminController {
    @Autowired
    private AdminService adminService;

    @RequestMapping("admin/login/{username}/{password}")
    public CommentResult login(@PathVariable("username") String username,
                               @PathVariable("password") String password)
    {
        Admin admin = adminService.login(username, password);
        return new CommentResult(200,"success",admin);
    }
}
